/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.portalnahouby.implementation.entity;

import cz.muni.fi.pa165.portalnahouby.api.dto.Edibility;
import cz.muni.fi.pa165.portalnahouby.api.dto.Month;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 * Class representing mushroom
 * 
 * @author Jakub Kutil
 */
@Entity
public class Mushroom implements Serializable {
 
    private static final long serialVersionUID = 1L;
    
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(unique=true, nullable=false) 
    private String name;
    
    @Column(nullable=false)
    @Enumerated(EnumType.STRING)
    private Edibility edibility;
    
    @Column(nullable=false) 
    private Month growFrom;
    
    @Column(nullable=false) 
    private Month growTo;

    public Long getId() {
        return id;
    }

    public void setId(Long Id) {
        this.id = Id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Edibility getEdibility() {
        return edibility;
    }

    public void setEdibility(Edibility edibility) {
        this.edibility = edibility;
    }

    public Month getGrowFrom() {
        return growFrom;
    }

    public void setGrowFrom(Month growFrom) {
        this.growFrom = growFrom;
    }

    public Month getGrowTo() {
        return growTo;
    }

    public void setGrowTo(Month growTo) {
        this.growTo = growTo;
    }
    
        @Override
    public int hashCode() {
        int hash = 5;
        hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Mushroom other = (Mushroom) obj;
        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Mushroom{" + "id=" + id + '}';
    }
    
}
